﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace SpaceMan.Entities.Attachments
{
    class C_ATT_LaserBlaster : I_AttachmentWeapon
    {
        DamageAffinity damageAffinity;
        SpaceMan.Particles.C_MuzzleEff1Emitter emitter;
        SpaceMan.Entities.Attachments.C_EFF_LightFlash flash;
        public C_ATT_LaserBlaster(DamageAffinity damageAffinity)
        {
            this.damageAffinity = damageAffinity;
            delayTimer = 150f;
            BaseInitialize(new Dictionary<string,Vector2>());
            AttachmentPoints.Add("muzzlepos", new Vector2(0, 0));
            AttachmentPoints.Add("emitter", new Vector2(0, 0));

            SpaceMan.Particles.C_MuzzleEff1Emitter emitter = new Particles.C_MuzzleEff1Emitter((float)Math.PI * 3 / 2, 0.7f);
            flash = new C_EFF_LightFlash(Vector2.Zero, 0.075f, 0.05f, 10, false);
            base.BaseInitialize(AttachmentPoints);
            this.emitter = emitter; 
            base.AddAttachment("emitter", emitter);
            base.AddAttachment("muzzlepos", flash);
        }

        public override void Fire()
        {
            if (readyToFire)
            {
                currentTime = delayTimer;
                new C_PRJ_StandardBullet(AttachmentPoints["muzzlepos"] + Position, Rotation, Velocity,damageAffinity);
                emitter.EmitParticles();
                flash.UserInput1();
                readyToFire = false;
            }
        }
    }
}
